package Homework2;

public class DigitExtraction {
    public static int digitExtraction(String input){
        StringBuilder d = new StringBuilder();
        for (int i = 0; i < input.length(); i++){
            char c = input.charAt(i);
            if (Character.isDigit(c)){
                d.append(c);
            }
        }
        if (d.length() == 0)
            return 0;
        return Integer.parseInt(d.toString());
    }
}
